// import React from 'react'
// import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'
// import HomePage from '@/pages/Home'
// import DetailsPage from '@/pages/Details'

// const RouterPages = () => {
//   return (
//     <BrowserRouter>
//       <Routes>
//         <Route path="/" element={<HomePage />} />
//         <Route path="/Home" element={<HomePage />} />
//         <Route path="/Details" element={<DetailsPage />} />
//         <Route path="*" element={<Navigate to="/" />} />
//       </Routes>
//     </BrowserRouter>
//   )
// }
// export default RouterPages

import { Navigate, RouteObject, useRoutes } from 'react-router-dom'
import React, { Suspense, lazy } from 'react'
import Layout from '@/layout'
import Detail from '@/layout/Detail'

import InstancePage from '@/pages/Instance'
import Buy from '@/pages/Buy'

const routes: RouteObject[] = [
  {
    path: '/',
    element: <Navigate replace to="/console/instance" />
  },
  {
    path: '/console',
    element: <Layout />,
    children: [
      {
        path: '/console/instance',
        element: <InstancePage />
      }
    ]
  },
  {
    path: '/detail',
    element: <Detail />,
    children: [
      {
        path: '/detail/buy',
        element: <Buy />
      }
    ]
  },
  {
    path: '*',
    element: <Navigate replace to="/console/instance" />
  }
]

const Routes = () => useRoutes(routes)

export { Routes }
